//
//  RSDBTable.h
//  Cellar Tracker
//
//  Created by Johnnie Walker on 09/07/2008.
//  Copyright 2008 Random Sequence. All rights reserved.
//

#import <UIKit/UIKit.h>
@class RSDBRecord, RSDBDatabase, RSDBQuery;
@interface RSDBTable : NSObject {
	NSString *tableName;
	RSDBDatabase *database;	
	NSMutableDictionary *columns;
	NSString *primaryKeyColumnName;
	BOOL exists;
}

@property (nonatomic, retain) NSString *tableName;
@property (nonatomic, retain) RSDBDatabase *database;
@property (nonatomic, retain) NSMutableDictionary *columns;
@property (nonatomic, retain) NSString *primaryKeyColumnName;
@property (nonatomic) BOOL exists;

- (id)initWithTableName:(NSString *)name database:(RSDBDatabase *)db;
- (Class)recordClass;

- (RSDBRecord *)find:(id)identifier;
- (NSArray *)findAll;

- (RSDBRecord *)findOneBySQL:(NSString *)sql, ...;
- (RSDBRecord *)findOneBySQL:(NSString *)sql arguments:(NSArray *)args;

- (NSArray *)findBySQL:(NSString *)sql, ...;
- (NSArray *)findBySQL:(NSString *)sql arguments:(NSArray *)args;

- (void)empty;

- (RSDBRecord *)createRecord;
- (BOOL)hasColumn:(NSString *)columnName;

- (RSDBQuery *)createQuery;
@end
